<%@ page import="com.walnut.pojo.Food" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>食品列表</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      margin: 20px;
      background-color: #f9f9f9;
    }
    .container {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 20px;
    }
    .card {
      border: 1px solid #ccc;
      border-radius: 5px;
      padding: 10px;
      width: 200px;
      text-align: center;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
      transition: transform 0.2s ease-in-out;
    }
    .card:hover {
      transform: translateY(-10px);
    }
    .card img {
      max-width: 100%;
      height: auto;
      border-radius: 5px;
    }
    .card h3 {
      margin-top: 10px;
      margin-bottom: 5px;
      color: #333;
    }
    .card p {
      margin: 5px 0;
      color: #666;
    }
    .card p:first-child {
      font-weight: bold;
    }
    .card p:last-child {
      color: #999;
    }
  </style>
</head>
<body>
<h1>食品列表</h1>
<div class="container">
  <%
    List<Food> foods = (List<Food>) request.getAttribute("foods");
    if (foods != null) {
      for (Food food : foods) {
  %>
  <div class="card">
    <img src="<%= food.getFoodImg() %>" alt="<%= food.getFoodName() %>">
    <h3><%= food.getFoodName() %></h3>
    <p>价格: <%= food.getPrice() %>￥</p>
    <p><%= food.getFoodStatus() %></p>
  </div>
  <%
      }
    }
  %>
</div>
</body>
</html>
